package com.community.service.impl;

import com.community.common.utils.DateUtils;
import com.community.common.utils.SecurityUtils;
import com.community.domain.HouseEntity;
import com.community.mapper.HouseMapper;
import com.community.service.HouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class HouseServiceImpl implements HouseService {
    @Autowired
    private HouseMapper houseMapper;
    @Override
    public List<HouseEntity> selectHouseList(HouseEntity house) {
        return houseMapper.selectHouseList(house);
    }

    @Override
    public Integer addHouse(HouseEntity house) {
        house.setCreateTime(DateUtils.getNowDate());
        house.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserId()));
        return houseMapper.addHouse(house);
    }

    @Override
    public int updateHouse(HouseEntity house) {
        house.setUpdateTime(DateUtils.getNowDate());
        house.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserId()));
        return houseMapper.updateHouse(house);
    }

    @Override
    public int deleteById(int id) {
        return houseMapper.deleteById(id);
    }

    @Override
    public int houseType(String type) {
        return houseMapper.houseType(type);
    }

    @Override
    public HouseEntity checkHouseNum(String house) {
        return houseMapper.checkHouseNum(house);
    }

}
